<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<title>登录</title>
<link rel="stylesheet" type="text/css" href="css/base.css">
<link rel="stylesheet" type="text/css" href="css/common.css">
<script type="text/javascript" src="js/jquery.min.js" ></script>
<script src="js/common.js"></script>
  <script src="js/cookie.js"></script>
</head>

<body>
<header class="header" id="header">
<a href="javascript:history.go(-1)" target=_self class="back">会员登录</a>

</header>
<!--header-end-->

<script>

  function login() {

    $.ajax({
      url: "http://localhost:8080/sys/users/userLogin",
      dataType: "json",
      type: "POST",
      data: $('#loginForm').serialize(),
      success: function (data) {

          if(data.flag){
            alert(data.msg)
            setCookie("uid",""+data.list[0].id,0.1)
            window.location.href="/index.html"

          }else{
            alert(data.msg)
            window.location.href="/login.html"

          }




      },
      error: function () {
        alert("数据错误")
      }

    })
  }



</script>
<div class="container" id="container">

  <div class="grace-body">
    <form id="loginForm"  class="grace-form grace-margin-top">
      <div class="grace-items2"style="font-size:15px" >
        <div class="grace-label2" >用户名：
          <input dir='rtl' style="float: right" class="input2" name="uname" placeholder="请填写用户名"  type="text"></input>
      </div>
      </div>
      <div class="grace-items2" style="font-size:15px">
        <div class="grace-label2">密码：
          <input dir='rtl' style="float: right" class="input2" name="pwd" placeholder="请填写用户密码"  type="password">

        </div>
      </div>

      <div style="padding:22px 0;">
        <button type="primary" onclick="login()" style="width:100%;height: 50px;font-size:20px" >登录</button>
      </div>

    </form>
  </div>

</div>
<!--container-end-->
</body>
</html>
